
<?php
require_once 'connexion (2).php';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$trie=null;
if(!(isset($_GET['trie'])))
{
    $trie='';
}else{ $trie=isset($_GET['trie']); echo $trie;}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" href="feuilledestyle.css">
        <link rel="stylesheet" href="menuHead/jquery.cleditor.css">
        <link href="menu2/styles.css" rel="stylesheet" type="text/css">
    </head>
    <body vlink="blue">
        <div id="page">
        <?php include 'header.php';?>
        <div id="cadre">
        <?php include 'menu.php';
        
        if (isset($_SESSION['mail']))
		{
                $ses1=$_SESSION['mail'];
		
                $vco1="select * from personne where MAILPERSONNE ='".$ses1."'";
		$res1=$connexion->query($vco1);//mysql_query($vco1) or die ('erreur dans la requete select :'.mysql_error());
		
		
					
		if($donne =$res1->fetch(PDO::FETCH_ASSOC))
		    { 
			$statut1=$donne['TYPEPERSONNE'];
			//$aut=$donne['autori'];
			
			if ($statut1 == "admin")
			   {?>  
            <FORM style="float:left; margin-top: 20px; background-color: orange; "> <INPUT TYPE="button" VALUE="Retour" onClick="history.back()"> </FORM> 
                <div class="centre">
                     <br>
                            <h3  style="margin-bottom: 124px;" >Liste des Comptes Rendu </h3>
                            
                            <table border="0">
                                 <tr>
                                 <form id="fges" enctype="multipart/form-data" action="listeEntreprise.php" method="GET">
                                    <th>Trier par  :&nbsp;&nbsp;</th>
                                    <td style="float:left;"><select id="triEnreprise"><option value="fref">fref</option><option value="frr">Formation</option><option value="vil">Ville</option><option value="...">...</option></select></td>
                                    <td style="float:left;"><a <?php echo' href="listeEntreprise.php?trie="123"';  ?> >Lancer la recherche</a></td>
                                 </form>
                                 </tr>
                            </table><br>
                            
                            <table border="1" style="margin-left: auto; margin-right: auto;  color: slategray; /*-moz-background-clip:*/ max-width:600px;">
                                
                                <tr>    
                                    <th>Nom-Prénom : </th>
                                    <th>Date stage : </th>
                                    <th>Entreprise : </th>
                                    <th>Formation : </th>
                                </tr>
                                
                                <?php 
                                               
                                              $req_rando="select distinct(c.IDSTAGE),NOMPERSONNE,PRENOMPERSONNE,DATEDEBUT,DATEFIN,NOMENTREPRISE,LIBELLEFORMATION from compterendu as c, stage as s, eleve as e, personne as p,
                                                           entreprise as ent, formation as fo where
                                                   p.IDPERSONNE=e.IDELEVE AND e.IDELEVE=s.IDELEVE AND s.IDSTAGE=c.IDSTAGE AND ent.IDENTREPRISE=s.IDENTREPRISE AND fo.IDFORMATION=s.IDFORMATION";// AND c.ISTAGE=".$ids;
                                              
                                              
                                              $resu_ra=$connexion->query($req_rando);
                                              
                                                   while ($rep=$resu_ra->fetch(PDO::FETCH_ASSOC))
                                                   {
                                                       $IDC=$rep["IDSTAGE"];
                                                       $nom=$rep["NOMPERSONNE"];
                                                       $pnom=$rep["PRENOMPERSONNE"];
                                                       $dd=$rep["DATEDEBUT"];
                                                       $df=$rep["DATEFIN"];
                                                       $nEnt=$rep["NOMENTREPRISE"]; 
                                                       $form=$rep["LIBELLEFORMATION"];
                                                       
                                                       echo '<tr>
                                                                 <td style="float:leftd;">'.$nom.' '.$pnom.'</td>
                                                                 <td style="float:leftd;">'.mDate($dd).'/'.mDate($df).'</td>
                                                                 <td style="float:leftd;">'.$nEnt.'</td>
                                                                 <td style="float:leftd;">'.$form.'</td>
                                                                 <td style="float:leftd;"><a href="compteRendu.php?id='.$IDC.'" target="_block"> Aller voir</a> </td>
                                                             </tr>';
                                                   }
                                                  
                                              ?>
                               
                                
                               
                            </table>
                       
                        
                  </div>
                  <?php 
                           }else
			   {?>
            <div class="centre">
                     <br>
                            <h3  style="margin-bottom: 124px;" >Liste des Comptes Rendu </h3>
                            
                            <table border="0">
                                 <tr>
                                 <form id="fges" enctype="multipart/form-data" action="listeEntreprise.php" method="GET">
                                    <th>Trier par  :&nbsp;&nbsp;</th>
                                    <td style="float:left;"><select id="triEnreprise"><option value="fref">fref</option><option value="frr">Formation</option><option value="vil">Ville</option><option value="...">...</option></select></td>
                                    <td style="float:left;"><a <?php echo' href="listeEntreprise.php?trie="123"';  ?> >Lancer la recherche</a></td>
                                 </form>
                                 </tr>
                            </table><br>
                            
                            <table border="1" style="margin-left: auto; margin-right: auto;  color: slategray; /*-moz-background-clip:*/ max-width:600px;">
                                
                                <tr>    
                                    <th>Nom-Prénom : </th>
                                    <th>Date stage : </th>
                                    <th>Entreprise : </th>
                                    <th>Formation : </th>
                                </tr>
                                
                                <?php 
                                               
                                              $req_rando="select distinct(c.IDSTAGE),NOMPERSONNE,PRENOMPERSONNE,DATEDEBUT,DATEFIN,NOMENTREPRISE,LIBELLEFORMATION from compterendu as c, stage as s, enseignant as e, personne as p,
                                                           entreprise as ent, formation as fo where
                                                   p.IDPERSONNE=e.IDENSEIGNANT AND e.IDENSEIGNANT=s.IDENSEIGNANT AND s.IDSTAGE=c.IDSTAGE AND ent.IDENTREPRISE=s.IDENTREPRISE AND fo.IDFORMATION=s.IDFORMATION AND p.MAILPERSONNE='".$ses1."'";// AND c.ISTAGE=".$ids;
                                              
                                              
                                              $resu_ra=$connexion->query($req_rando);
                                              
                                                   while ($rep=$resu_ra->fetch(PDO::FETCH_ASSOC))
                                                   {
                                                       $IDC=$rep["IDSTAGE"];
                                                       $nom=$rep["NOMPERSONNE"];
                                                       $pnom=$rep["PRENOMPERSONNE"];
                                                       $dd=$rep["DATEDEBUT"];
                                                       $df=$rep["DATEFIN"];
                                                       $nEnt=$rep["NOMENTREPRISE"]; 
                                                       $form=$rep["LIBELLEFORMATION"];
                                                       
                                                       echo '<tr>
                                                                 <td style="float:leftd;">'.$nom.' '.$pnom.'</td>
                                                                 <td style="float:leftd;">'.mDate($dd).'/'.mDate($df).'</td>
                                                                 <td style="float:leftd;">'.$nEnt.'</td>
                                                                 <td style="float:leftd;">'.$form.'</td>
                                                                 <td style="float:leftd;"><a href="compteRendu.php?id='.$IDC.'" target="_block"> Aller voir</a> </td>
                                                             </tr>';
                                                   }
                                                  
                                              ?>
                               
                                
                               
                            </table>
                       
                        
                  </div>
            
            
            
             <?php
                           }}}require_once 'pied.php';?> 
        </div> 
        </div>
    </body>
</html>
 